home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / lsdoor09.zip / REINDEX.CPP < prev    next >
Text File  |  1996-05-15  |  875b  |  45 lines

  1. // This is an example of how you can re-index damage database...
  2.  
  3. // This is only a code fragment.  You will have to replace 'database'
  4. // with the name of your database, and database.keydata with whatever you
  5. // are using for a key.
  6.  
  7. #define MainModule
  8. #include "LsDoor.h"
  9.  
  10. extern int DisableIndexes;
  11.  
  12. Entry entry;
  13. Index ixp;
  14.  
  15. void main( void )
  16. {
  17.   int ii, ret;
  18.  
  19.   DisableIndexes = true;
  20.   printf("\nReindexing the database...");
  21.   create_index( "User.Idx", &ixp, 1 );
  22.   ii=0;
  23.   open_database();
  24.   while( next_database() )
  25.   {
  26.     scanner();
  27.     strcpy( entry.key, database.keydata );
  28.     entry.data = _data_fpos;
  29.     ret = add_key( &ixp, &entry );
  30.     if( ret ){ printf("\nError adding key!\n"); break; }
  31.   }
  32.   clear_scanner();
  33.   close_database();
  34.   close_index( &ixp );
  35.  
  36.   DisableIndexes = false;
  37. }
  38.  
  39.  
  40. // End of ReIndex.Cpp
  41.  
  42.  
  43.  
  44.  
  45.